Technical Q&As


DV 28 - Serial Flow Control Bug (11-July-97)


Q I'm calling the serial driver to clear XON/XOFF flow control but flow control is not being lifted. What's going on?

A You have stumbled across a bug in Apple system software (ID 1635221). The File System Manager patches _Control in such a way that the serdClrXOff (csCode = 22) is mistaken for a block device "Return Media Icon" (csCode = 22) call. This causes the serdClrXOff to never make it to the serial driver.

The simplest workaround is to clear ioVRefNum before making the serdClrXOff call. The following code snippet demonstrates this technique.

OSErr DoClearXOff(short serialOutDrvrRefNum)
{
  CntrlParam pb;

  pb.ioCRefNum = serialOutDrvrRefNum;
  pb.csCode = serdClrXOff;
  pb.ioVRefNum = 0;
  // This above line is required because of a bug
  // in system software. The workaround, clearing
  // ioVRefNum, should be benign when the bug is fixed
  // in future systems.

  return ( PBControlSync( (ParmBlkPtr) &pb ) );
}

This bug was fixed in Mac OS 8.0.



--Quinn "The Eskimo!"
Worldwide Developer Technical Support

Technical Q&As
Previous Question | Contents | Next Question

To contact us, please use the Contact Us page.